Start date: 03-01-2021
End date: 03-01-2021
Analysed by: Ruth Chia
Working directory: /data/NDRS_LNG/MyastheniaGravis/updated.April2020/Itals/Analysis.GLM.hg38.rerun
Notes about this rerun: Needed to remove some controls samples from dbGAP because they no longer are available for use.
!pwd
CLEAN raw genotype file for related+unrelated samples:/data/NDRS_LNG/MyastheniaGravis/updated.April2020/Itals/CLEAN.rawGenotype.UNRELATED/FILTERED.Itals_mg_noDups.UNRELATED.hwe1e-10.geno005.bed/bim/fam/data/NDRS_LNG/MyastheniaGravis/updated.April2020/Itals/Imputation.hg38/chr${CHNUM}.dose.vcf.gz/data/NDRS_LNG/MyastheniaGravis/updated.April2020/Itals/Imputation.hg38/chr${CHNUM}.dose.vcf.gz.tbi/data/NDRS_LNG/MyastheniaGravis/updated.April2020/Itals/Imputation.hg38/Vars.Rsq03MAF00001/Rsq03MAF00001.chr${CHNUM}.txt/data/NDRS_LNG/MyastheniaGravis/updated.April2020/Itals/COVARIATES.Itals_mg_noDups.UNRELATED.txtGENDER,age_at_onset,PC1,PC2,PC3,PC4,PC5,PC6,PC10%%bash
DATA="/data/NDRS_LNG/MyastheniaGravis/updated.April2020/Itals"
COVAR="GENDER,age_at_onset,PC1,PC2,PC3,PC4,PC5,PC6,PC10"
for CHNUM in {1..22};
do
echo "plink \
--vcf $DATA/Imputation.hg38/chr${CHNUM}.dose.vcf.gz \
--extract $DATA/Imputation.hg38/Vars.Rsq03MAF00001/Rsq03MAF00001.chr${CHNUM}.txt \
--double-id \
--pheno-name PHENO \
--pheno ../COVARIATES.Itals_mg_noDups.UNRELATED.forGLM.txt \
--covar ../COVARIATES.Itals_mg_noDups.UNRELATED.forGLM.txt \
--glm hide-covar firth-fallback cols=+a1freq,+a1freqcc,+a1count,+totallele,+a1countcc,+totallelecc,+err \
--out MG.ITALS.noDups.UNRELATED.hg38.glm_chr${CHNUM} \
--covar-name $COVAR \
--covar-variance-standardize" >> GWAS.MG.swarm
done
swarm --file GWAS.MG.swarm \
--logdir swarmOE_GWAS.LBD \
--gres=lscratch:800 \
-t 32 --partition quick -g 120 --time 02:00:00 \
--module plink/2.0-dev-20191128 \
--sbatch '--constraint=ibfdr'
# View glm log file
!cat MG.ITALS.noDups.UNRELATED.hg38.glm_chr1.log
then filter by maf(cases): 0.001, 0.01, 0.05
%%bash
head -n 1 MG.ITALS.noDups.UNRELATED.hg38.glm_chr1.PHENO.glm.logistic.hybrid > MG.ITALS.noDups.UNRELATED.hg38.glm.Rsq03MAF00001_ALLchr.txt
for CHNUM in {1..22}
do
tail -n +2 MG.ITALS.noDups.UNRELATED.hg38.glm_chr${CHNUM}.PHENO.glm.logistic.hybrid >> MG.ITALS.noDups.UNRELATED.hg38.glm.Rsq03MAF00001_ALLchr.txt
done
## Filter by maf (cases)
awk 'NR==1;NR>1 {if($14 >= 0.001) print}' MG.ITALS.noDups.UNRELATED.hg38.glm.Rsq03MAF00001_ALLchr.txt > MG.ITALS.noDups.UNRELATED.hg38.glm.Rsq03.maf0001cases_ALLchr.txt
awk 'NR==1;NR>1 {if($14 >= 0.01) print}' MG.ITALS.noDups.UNRELATED.hg38.glm.Rsq03.maf0001cases_ALLchr.txt > MG.ITALS.noDups.UNRELATED.hg38.glm.Rsq03.maf001cases_ALLchr.txt
awk 'NR==1;NR>1 {if($14 >= 0.05) print}' MG.ITALS.noDups.UNRELATED.hg38.glm.Rsq03.maf001cases_ALLchr.txt > MG.ITALS.noDups.UNRELATED.hg38.glm.Rsq03.maf005cases_ALLchr.txt
awk 'NR==1;NR>1 {if($13 >= 0.001) print}' MG.ITALS.noDups.UNRELATED.hg38.glm.Rsq03MAF00001_ALLchr.txt > MG.ITALS.noDups.UNRELATED.hg38.glm.Rsq03.maf0001_ALLchr.txt
awk 'NR==1;NR>1 {if($13 >= 0.01) print}' MG.ITALS.noDups.UNRELATED.hg38.glm.Rsq03.maf0001_ALLchr.txt > MG.ITALS.noDups.UNRELATED.hg38.glm.Rsq03.maf001_ALLchr.txt
awk 'NR==1;NR>1 {if($13 >= 0.05) print}' MG.ITALS.noDups.UNRELATED.hg38.glm.Rsq03.maf001_ALLchr.txt > MG.ITALS.noDups.UNRELATED.hg38.glm.Rsq03.maf005_ALLchr.txt
wc -l MG.ITALS.noDups.UNRELATED.hg38.glm.Rsq03MAF00001_ALLchr.txt
wc -l MG.ITALS.noDups.UNRELATED.hg38.glm.Rsq03.maf00*_ALLchr.txt
%%bash
# Remove single files
rm MG.ITALS.noDups.UNRELATED.hg38.glm_chr*.PHENO.glm.logistic.hybrid
rm MG.ITALS.noDups.UNRELATED.hg38.glm_chr*.log
%%bash
# check header of covariate file
head -n 1 ../COVARIATES.Itals_mg_noDups.UNRELATED.forGLM.txt | tr '\t' '\n' | cat -n
%%bash
awk 'NR==1;NR>1 {if($8 != "NA") print}' ../COVARIATES.Itals_mg_noDups.UNRELATED.forGLM.txt | awk 'NR==1;NR>1 {if($20 != "NA") print}' | cut -f6 | sort | uniq -c
%%bash
echo "Breakdown of controls by sex:"
awk 'NR==1;NR>1 {if($8 != "NA" && $20 != "NA" && $6 == 1) print}' ../COVARIATES.Itals_mg_noDups.UNRELATED.forGLM.txt | cut -f5 | sort | uniq -c
echo "Breakdown of cases by sex:"
awk 'NR==1;NR>1 {if($8 != "NA" && $20 != "NA" && $6 == 2) print}' ../COVARIATES.Itals_mg_noDups.UNRELATED.forGLM.txt | cut -f5 | sort | uniq -c
%%bash
echo "Number of case alleles:"
cut -f11 MG.ITALS.noDups.UNRELATED.hg38.glm.Rsq03.maf005_ALLchr.txt | sort | uniq -c
echo "Number of control alleles:"
cut -f12 MG.ITALS.noDups.UNRELATED.hg38.glm.Rsq03.maf005_ALLchr.txt | sort | uniq -c
%%bash
CASES="909"
CONTROLS="2413"
echo "Rscript ../scripts/QQ_manhattan_plots_GLMresults.FromImputed.wgs.R MG.ITALS.noDups.UNRELATED.hg38.glm.Rsq03.maf001cases_ALLchr.txt ${CASES} ${CONTROLS} MG.ITALS.unrelated.Rsq03.maf001cases.hg38.glm-dosage" > plot.swarm
echo "Rscript ../scripts/QQ_manhattan_plots_GLMresults.FromImputed.wgs.R MG.ITALS.noDups.UNRELATED.hg38.glm.Rsq03.maf005cases_ALLchr.txt ${CASES} ${CONTROLS} MG.ITALS.unrelated.Rsq03.maf005cases.hg38.glm-dosage" >> plot.swarm
echo "Rscript ../scripts/QQ_manhattan_plots_GLMresults.FromImputed.wgs.R MG.ITALS.noDups.UNRELATED.hg38.glm.Rsq03.maf001_ALLchr.txt ${CASES} ${CONTROLS} MG.ITALS.unrelated.Rsq03.maf001.hg38.glm-dosage" >> plot.swarm
echo "Rscript ../scripts/QQ_manhattan_plots_GLMresults.FromImputed.wgs.R MG.ITALS.noDups.UNRELATED.hg38.glm.Rsq03.maf005_ALLchr.txt ${CASES} ${CONTROLS} MG.ITALS.unrelated.Rsq03.maf005.hg38.glm-dosage" >> plot.swarm
swarm --file plot.swarm --logdir swarmOE_plot --module R/3.5.2 --time 04:00:00 -g 120
%%bash
CASES="909"
CONTROLS="2413"
echo "Rscript ../scripts/QQ_manhattan_plots_GLMresults.FromImputed.wgs.R MG.ITALS.noDups.UNRELATED.hg38.glm.Rsq03.maf001cases.hwe1e-6_ALLchr.txt ${CASES} ${CONTROLS} MG.ITALS.unrelated.Rsq03.maf001cases.hwe1e-6.hg38.glm-dosage" > plot2.swarm
echo "Rscript ../scripts/QQ_manhattan_plots_GLMresults.FromImputed.wgs.R MG.ITALS.noDups.UNRELATED.hg38.glm.Rsq03.maf005cases.hwe1e-6_ALLchr.txt ${CASES} ${CONTROLS} MG.ITALS.unrelated.Rsq03.maf005cases.hwe1e-6.hg38.glm-dosage" >> plot2.swarm
echo "Rscript ../scripts/QQ_manhattan_plots_GLMresults.FromImputed.wgs.R MG.ITALS.noDups.UNRELATED.hg38.glm.Rsq03.maf001.hwe1e-6_ALLchr.txt ${CASES} ${CONTROLS} MG.ITALS.unrelated.Rsq03.maf001.hwe1e-6.hg38.glm-dosage" >> plot2.swarm
echo "Rscript ../scripts/QQ_manhattan_plots_GLMresults.FromImputed.wgs.R MG.ITALS.noDups.UNRELATED.hg38.glm.Rsq03.maf005.hwe1e-6_ALLchr.txt ${CASES} ${CONTROLS} MG.ITALS.unrelated.Rsq03.maf005.hwe1e-6.hg38.glm-dosage" >> plot2.swarm
swarm --file plot2.swarm --logdir swarmOE_plot --module R/3.5.2 --time 04:00:00 -g 120
from IPython.display import display
from PIL import Image
print("Manhattan & QQ plots \nMG.ITALS, Rsq > 0.3, maf(all) > 0.01")
manhattan="MG.ITALS.unrelated.Rsq03.maf001.hg38.glm-dosage.manhattan_v0.jpeg"
display(Image.open(manhattan))
qq="MG.ITALS.unrelated.Rsq03.maf001.hg38.glm-dosage.QQ.jpeg"
display(Image.open(qq))
import pandas as pd
import numpy as np
mg = pd.read_csv("MG.ITALS.noDups.UNRELATED.hg38.glm.Rsq03.maf001_ALLchr.txt",sep="\t")
mgSignificant2 = mg[(mg['P'] <= 0.00000005) & (mg['#CHROM'] != 6)]
mgSignificant2 = mgSignificant2.sort_values(by=['#CHROM','POS'])
mgSignificant2.drop(['TEST','OBS_CT','Z_STAT','ERRCODE'],axis=1)
import pandas as pd
import numpy as np
mg = pd.read_csv("MG.ITALS.noDups.UNRELATED.hg38.glm.Rsq03.maf001_ALLchr.txt",sep="\t")
mg[(mg['POS'] == 174764492) & (mg['#CHROM'] == 2)].drop(['TEST','OBS_CT','Z_STAT','ERRCODE'],axis=1)
!cat ../scripts/toMetaprep.glm.updated.v2.R
%%bash
#module load R/3.5.2
echo "Rscript ../scripts/toMetaprep.glm.updated.v2.R MG.ITALS.noDups.UNRELATED.hg38.glm.Rsq03MAF00001_ALLchr.txt MG.ITALS.noDups.UNRELATED.hg38.glm.Rsq03MAF00001" > prep.swarm
echo "Rscript ../scripts/toMetaprep.glm.updated.v2.R MG.ITALS.noDups.UNRELATED.hg38.glm.Rsq03MAF00001.hwe1e-6_ALLchr.txt MG.ITALS.noDups.UNRELATED.hg38.glm.Rsq03MAF00001.hwe1e-6" >> prep.swarm
swarm --file prep.swarm --logdir swarmOE_prep -g 120 --module R/3.5.2 --gres=lscratch:500 --time 4:00:00
%%bash
# View top hits from meta analysis
DIR="/data/NDRS_LNG/MyastheniaGravis/updated.April2020/MetaAnalysis.hg38.ByCohort.rerun/USmerged.Itals.hg38"
cat $DIR/IndexVarsSummStats.META_MG.USmerged.Itals.UNRELATED.hg38.Rsq03.filteredDirectionHetISq80MAF001cases.p5e-8.txt | column -t
Get imputation info for each index variant/hit from Italian cohort. Need to make sure that the imputation quality are good across imputed cohorts.
%%bash
DATA="/data/NDRS_LNG/MyastheniaGravis/updated.April2020/Itals"
head -n 1 $DATA/Imputation.hg38/chr1.info > topHits.ImputationInfo.Itals.txt
grep "chr1:113834946:" $DATA/Imputation.hg38/chr1.info >> topHits.ImputationInfo.Itals.txt
grep "chr2:174764492:" $DATA/Imputation.hg38/chr2.info >> topHits.ImputationInfo.Itals.txt
grep "chr6:32620936:" $DATA/Imputation.hg38/chr6.info >> topHits.ImputationInfo.Itals.txt
grep "chr8:108247378:" $DATA/Imputation.hg38/chr8.info >> topHits.ImputationInfo.Itals.txt
grep "chr10:7410781:" $DATA/Imputation.hg38/chr10.info >> topHits.ImputationInfo.Itals.txt
grep "chr11:95578258:" $DATA/Imputation.hg38/chr11.info >> topHits.ImputationInfo.Itals.txt
grep "chr18:62355088:" $DATA/Imputation.hg38/chr18.info >> topHits.ImputationInfo.Itals.txt
import pandas as pd
pd.read_csv("topHits.ImputationInfo.Itals.txt",sep="\t")
List of single index variants per loci to condition on:
Notes:
chr6:32620936:T:C revealed there was a second independent peak in the same locus. The top hit here is chr6:31358836:G:A.%%bash
# create list of snps to condition on
echo "chr1:113834946:A:G" > IndexVars.ConditionList.txt
echo "chr2:174764492:G:A" >> IndexVars.ConditionList.txt
echo "chr6:32620936:T:C" >> IndexVars.ConditionList.txt
echo "chr8:108247378:T:C" >> IndexVars.ConditionList.txt
echo "chr10:7410781:A:G" >> IndexVars.ConditionList.txt
echo "chr11:95578258:T:C" >> IndexVars.ConditionList.txt
echo "chr18:62355088:C:T" >> IndexVars.ConditionList.txt
cat IndexVars.ConditionList.txt
%%bash
mkdir ConditionalAnalysis
DATA="/data/NDRS_LNG/MyastheniaGravis/updated.April2020/Itals"
COVAR="GENDER,age_at_onset,PC1,PC2,PC3,PC4,PC5,PC6,PC10"
for CHNUM in {1,2,6,8,10,11,18};
do
echo "plink \
--vcf $DATA/Imputation.hg38/chr${CHNUM}.dose.vcf.gz \
--extract $DATA/Imputation.hg38/Vars.Rsq03MAF00001/Rsq03MAF00001.chr${CHNUM}.txt \
--double-id \
--pheno-name PHENO \
--pheno ../COVARIATES.Itals_mg_noDups.UNRELATED.forGLM.txt \
--covar ../COVARIATES.Itals_mg_noDups.UNRELATED.forGLM.txt \
--glm hide-covar firth-fallback cols=+a1freq,+a1freqcc,+a1count,+totallele,+a1countcc,+totallelecc,+err \
--out ConditionalAnalysis/MG.Itals.noDups.UNRELATED.hg38.conditioned.glm_chr${CHNUM} \
--condition-list IndexVars.ConditionList.txt \
--covar-name $COVAR \
--covar-variance-standardize" >> GWAS.condition.swarm
done
%%bash
swarm --file GWAS.condition.swarm \
--logdir swarmOE_GWAS.MG \
--gres=lscratch:800 \
-t 32 --partition quick -g 120 --time 04:00:00 \
--module plink/2.0-dev-20191128 \
--sbatch '--constraint=ibfdr'
%%bash
DATA="/data/NDRS_LNG/MyastheniaGravis/updated.April2020/Itals"
COVAR="GENDER,age_at_onset,PC1,PC2,PC3,PC4,PC5,PC6,PC10"
for CHNUM in 6;
do
echo "plink \
--vcf $DATA/Imputation.hg38/chr${CHNUM}.dose.vcf.gz \
--extract $DATA/Imputation.hg38/Vars.Rsq03MAF00001/Rsq03MAF00001.chr${CHNUM}.txt \
--double-id \
--pheno-name PHENO \
--pheno ../COVARIATES.Itals_mg_noDups.UNRELATED.forGLM.txt \
--covar ../COVARIATES.Itals_mg_noDups.UNRELATED.forGLM.txt \
--glm hide-covar firth-fallback cols=+a1freq,+a1freqcc,+a1count,+totallele,+a1countcc,+totallelecc,+err \
--out ConditionalAnalysis/MG.Itals.noDups.UNRELATED.hg38.conditioned.glm.chr6_31358836_A_G_chr${CHNUM} \
--condition chr6:31358836:A:G \
--covar-name $COVAR \
--covar-variance-standardize" > GWAS.condition.2.swarm
done
echo "chr6:31358836:A:G" > IndexVars.ConditionList.2.txt
echo "chr6:32620936:T:C" >> IndexVars.ConditionList.2.txt
for CHNUM in 6;
do
echo "plink \
--vcf $DATA/Imputation.hg38/chr${CHNUM}.dose.vcf.gz \
--extract $DATA/Imputation.hg38/Vars.Rsq03MAF00001/Rsq03MAF00001.chr${CHNUM}.txt \
--double-id \
--pheno-name PHENO \
--pheno ../COVARIATES.Itals_mg_noDups.UNRELATED.forGLM.txt \
--covar ../COVARIATES.Itals_mg_noDups.UNRELATED.forGLM.txt \
--glm hide-covar firth-fallback cols=+a1freq,+a1freqcc,+a1count,+totallele,+a1countcc,+totallelecc,+err \
--out ConditionalAnalysis/MG.Itals.noDups.UNRELATED.hg38.conditioned.glm.chr6_31358836_A_G.chr6_32620936_T_C_chr${CHNUM} \
--condition-list IndexVars.ConditionList.2.txt \
--covar-name $COVAR \
--covar-variance-standardize" >> GWAS.condition.2.swarm
done
%%bash
swarm --file GWAS.condition.2.swarm \
--logdir swarmOE_GWAS.MG \
--gres=lscratch:800 \
-t 32 --partition quick -g 120 --time 04:00:00 \
--module plink/2.0-dev-20191128 \
--sbatch '--constraint=ibfdr'
%%bash
cd ConditionalAnalysis
for Variant in chr1_113834946_A_G;
do
awk 'NR==1;NR>1 {if($22 != "NA" && $14 >= 0.01) print}' MG.Itals.noDups.UNRELATED.hg38.conditioned.glm_chr1.PHENO.glm.logistic.hybrid > MG.Itals.noDups.UNRELATED.hg38.glm.condition.${Variant}.chr1.maf001cases.txt
done
for Variant in chr2_174764492_G_A;
do
awk 'NR==1;NR>1 {if($22 != "NA" && $14 >= 0.01) print}' MG.Itals.noDups.UNRELATED.hg38.conditioned.glm_chr2.PHENO.glm.logistic.hybrid > MG.Itals.noDups.UNRELATED.hg38.glm.condition.${Variant}.chr2.maf001cases.txt
done
for Variant in chr6_32620936_T_C;
do
awk 'NR==1;NR>1 {if($22 != "NA" && $14 >= 0.01) print}' MG.Itals.noDups.UNRELATED.hg38.conditioned.glm_chr6.PHENO.glm.logistic.hybrid > MG.Itals.noDups.UNRELATED.hg38.glm.condition.${Variant}.chr6.maf001cases.txt
done
for Variant in chr8_108247378_T_C;
do
awk 'NR==1;NR>1 {if($22 != "NA" && $14 >= 0.01) print}' MG.Itals.noDups.UNRELATED.hg38.conditioned.glm_chr8.PHENO.glm.logistic.hybrid > MG.Itals.noDups.UNRELATED.hg38.glm.condition.${Variant}.chr8.maf001cases.txt
done
for Variant in chr10_7410781_A_G;
do
awk 'NR==1;NR>1 {if($22 != "NA" && $14 >= 0.01) print}' MG.Itals.noDups.UNRELATED.hg38.conditioned.glm_chr10.PHENO.glm.logistic.hybrid > MG.Itals.noDups.UNRELATED.hg38.glm.condition.${Variant}.chr10.maf001cases.txt
done
for Variant in chr11_95578258_T_C;
do
awk 'NR==1;NR>1 {if($22 != "NA" && $14 >= 0.01) print}' MG.Itals.noDups.UNRELATED.hg38.conditioned.glm_chr11.PHENO.glm.logistic.hybrid > MG.Itals.noDups.UNRELATED.hg38.glm.condition.${Variant}.chr11.maf001cases.txt
done
for Variant in chr18_62355088_C_T;
do
awk 'NR==1;NR>1 {if($22 != "NA" && $14 >= 0.01) print}' MG.Itals.noDups.UNRELATED.hg38.conditioned.glm_chr18.PHENO.glm.logistic.hybrid > MG.Itals.noDups.UNRELATED.hg38.glm.condition.${Variant}.chr18.maf001cases.txt
done
%%bash
cd ConditionalAnalysis
for Variant in {chr6_31358836_A_G,chr6_31358836_A_G.chr6_32620936_T_C};
do
awk 'NR==1;NR>1 {if($22 != "NA" && $14 >= 0.01) print}' MG.Itals.noDups.UNRELATED.hg38.conditioned.glm.${Variant}_chr6.PHENO.glm.logistic.hybrid > MG.Itals.noDups.UNRELATED.hg38.glm.condition.${Variant}.chr6.maf001cases.txt
done
%%bash
cd ConditionalAnalysis
## Tidy up directory
mkdir toArchive
mv MG.Itals.noDups.UNRELATED.hg38.conditioned.glm*_chr*.PHENO.glm.logistic.hybrid ./toArchive
mv MG.Itals.noDups.UNRELATED.hg38.conditioned.glm*_chr*.log ./toArchive
%%bash
awk 'NR==1;NR>1 {if($8 != "NA") print}' ../COVARIATES.Itals_mg_noDups.UNRELATED.forGLM.txt | awk 'NR==1;NR>1 {if($20 != "NA") print}' | cut -f6 | sort | uniq -c
%%bash
cd ConditionalAnalysis
# Plot chromosomes without conditional analysis for comparison
# First subset chromosome from summ stats
for CHNUM in {1,2,6,8,10,11,18}
do
awk "NR==1;NR>1 {if(\$1 == ${CHNUM}) print}" ../MG.ITALS.noDups.UNRELATED.hg38.glm.Rsq03.maf001cases_ALLchr.txt > summ.stats.unconditioned.chr${CHNUM}.txt
done
%%bash
cd ConditionalAnalysis
cases="909"
controls="2413"
echo "Rscript ../../scripts/QQ_manhattan_plots_GLMresults.FromImputed.wgs.R summ.stats.unconditioned.chr1.txt $cases $controls MG.Itals.noDups.UNRELATED.hg38.glm.Rsq03.maf001cases.unconditioned.chr1" > plot1.swarm
echo "Rscript ../../scripts/QQ_manhattan_plots_GLMresults.FromImputed.wgs.R summ.stats.unconditioned.chr2.txt $cases $controls MG.Itals.noDups.UNRELATED.hg38.glm.Rsq03.maf001cases.unconditioned.chr2" >> plot1.swarm
echo "Rscript ../../scripts/QQ_manhattan_plots_GLMresults.FromImputed.wgs.R summ.stats.unconditioned.chr6.txt $cases $controls MG.Itals.noDups.UNRELATED.hg38.glm.Rsq03.maf001cases.unconditioned.chr6" >> plot1.swarm
echo "Rscript ../../scripts/QQ_manhattan_plots_GLMresults.FromImputed.wgs.R summ.stats.unconditioned.chr8.txt $cases $controls MG.Itals.noDups.UNRELATED.hg38.glm.Rsq03.maf001cases.unconditioned.chr8" >> plot1.swarm
echo "Rscript ../../scripts/QQ_manhattan_plots_GLMresults.FromImputed.wgs.R summ.stats.unconditioned.chr10.txt $cases $controls MG.Itals.noDups.UNRELATED.hg38.glm.Rsq03.maf001cases.unconditioned.chr10" >> plot1.swarm
echo "Rscript ../../scripts/QQ_manhattan_plots_GLMresults.FromImputed.wgs.R summ.stats.unconditioned.chr11.txt $cases $controls MG.Itals.noDups.UNRELATED.hg38.glm.Rsq03.maf001cases.unconditioned.chr11" >> plot1.swarm
echo "Rscript ../../scripts/QQ_manhattan_plots_GLMresults.FromImputed.wgs.R summ.stats.unconditioned.chr18.txt $cases $controls MG.Itals.noDups.UNRELATED.hg38.glm.Rsq03.maf001cases.unconditioned.chr18" >> plot1.swarm
swarm --file plot1.swarm --logdir swarmOE_plot --module R/3.5.2 -g 120 --time 02:00:00 --partition quick
%%bash
cd ConditionalAnalysis
cases="909"
controls="2413"
echo "Rscript ../../scripts/QQ_manhattan_plots_GLMresults.FromImputed.wgs.R MG.Itals.noDups.UNRELATED.hg38.glm.condition.chr1_113834946_A_G.chr1.maf001cases.txt $cases $controls MG.Itals.noDups.UNRELATED.hg38.glm.condition.chr1_113834946_A_G.chr1.maf001cases" > plot2.swarm
echo "Rscript ../../scripts/QQ_manhattan_plots_GLMresults.FromImputed.wgs.R MG.Itals.noDups.UNRELATED.hg38.glm.condition.chr2_174764492_G_A.chr2.maf001cases.txt $cases $controls MG.Itals.noDups.UNRELATED.hg38.glm.condition.chr2_174764492_G_A.chr2.maf001cases" >> plot2.swarm
echo "Rscript ../../scripts/QQ_manhattan_plots_GLMresults.FromImputed.wgs.R MG.Itals.noDups.UNRELATED.hg38.glm.condition.chr6_32620936_T_C.chr6.maf001cases.txt $cases $controls MG.Itals.noDups.UNRELATED.hg38.glm.condition.chr6_32620936_T_C.chr6.maf001cases" >> plot2.swarm
echo "Rscript ../../scripts/QQ_manhattan_plots_GLMresults.FromImputed.wgs.R MG.Itals.noDups.UNRELATED.hg38.glm.condition.chr8_108247378_T_C.chr8.maf001cases.txt $cases $controls MG.Itals.noDups.UNRELATED.hg38.glm.condition.chr8_108247378_T_C.chr8.maf001cases" >> plot2.swarm
echo "Rscript ../../scripts/QQ_manhattan_plots_GLMresults.FromImputed.wgs.R MG.Itals.noDups.UNRELATED.hg38.glm.condition.chr10_7410781_A_G.chr10.maf001cases.txt $cases $controls MG.Itals.noDups.UNRELATED.hg38.glm.condition.chr10_7410781_A_G.chr10.maf001cases" >> plot2.swarm
echo "Rscript ../../scripts/QQ_manhattan_plots_GLMresults.FromImputed.wgs.R MG.Itals.noDups.UNRELATED.hg38.glm.condition.chr11_95578258_T_C.chr11.maf001cases.txt $cases $controls MG.Itals.noDups.UNRELATED.hg38.glm.condition.chr11_95578258_T_C.chr11.maf001cases" >> plot2.swarm
echo "Rscript ../../scripts/QQ_manhattan_plots_GLMresults.FromImputed.wgs.R MG.Itals.noDups.UNRELATED.hg38.glm.condition.chr18_62355088_C_T.chr18.maf001cases.txt $cases $controls MG.Itals.noDups.UNRELATED.hg38.glm.condition.chr18_62355088_C_T.chr18.maf001cases" >> plot2.swarm
swarm --file plot2.swarm --logdir swarmOE_plot --module R/3.5.2 -g 120 --time 02:00:00 --partition quick
%%bash
cd ConditionalAnalysis
cases="909"
controls="2413"
echo "Rscript ../../scripts/QQ_manhattan_plots_GLMresults.FromImputed.wgs.R MG.Itals.noDups.UNRELATED.hg38.glm.condition.chr6_31358836_A_G.chr6.maf001cases.txt $cases $controls MG.Itals.noDups.UNRELATED.hg38.glm.condition.chr6_31358836_A_G.chr6.maf001cases" > plot3.swarm
echo "Rscript ../../scripts/QQ_manhattan_plots_GLMresults.FromImputed.wgs.R MG.Itals.noDups.UNRELATED.hg38.glm.condition.chr6_31358836_A_G.chr6_32620936_T_C.chr6.maf001cases.txt $cases $controls MG.Itals.noDups.UNRELATED.hg38.glm.condition.chr6_31358836_A_G.chr6_32620936_T_C.chr6.maf001cases" >> plot3.swarm
swarm --file plot3.swarm --logdir swarmOE_plot --module R/3.5.2 -g 120 --time 02:00:00 --partition quick
from IPython.display import display
from PIL import Image
uncond="ConditionalAnalysis/MG.Itals.noDups.UNRELATED.hg38.glm.Rsq03.maf001cases.unconditioned.chr1.manhattan_v1.jpeg"
display(Image.open(uncond))
cond="ConditionalAnalysis/MG.Itals.noDups.UNRELATED.hg38.glm.condition.chr1_113834946_A_G.chr1.maf001cases.manhattan_v1.jpeg"
display(Image.open(cond))
from IPython.display import display
from PIL import Image
uncond="ConditionalAnalysis/MG.Itals.noDups.UNRELATED.hg38.glm.Rsq03.maf001cases.unconditioned.chr2.manhattan_v1.jpeg"
display(Image.open(uncond))
cond="ConditionalAnalysis/MG.Itals.noDups.UNRELATED.hg38.glm.condition.chr2_174764492_G_A.chr2.maf001cases.manhattan_v1.jpeg"
display(Image.open(cond))
from IPython.display import display
from PIL import Image
uncond="ConditionalAnalysis/MG.Itals.noDups.UNRELATED.hg38.glm.Rsq03.maf001cases.unconditioned.chr6.manhattan_v0.jpeg"
display(Image.open(uncond))
cond="ConditionalAnalysis/MG.Itals.noDups.UNRELATED.hg38.glm.condition.chr6_32620936_T_C.chr6.maf001cases.manhattan_v0.jpeg"
display(Image.open(cond))
from IPython.display import display
from PIL import Image
cond="ConditionalAnalysis/MG.Itals.noDups.UNRELATED.hg38.glm.condition.chr6_31358836_A_G.chr6.maf001cases.manhattan_v1.jpeg"
display(Image.open(cond))
from IPython.display import display
from PIL import Image
cond="ConditionalAnalysis/MG.Itals.noDups.UNRELATED.hg38.glm.condition.chr6_31358836_A_G.chr6_32620936_T_C.chr6.maf001cases.manhattan_v1.jpeg"
display(Image.open(cond))
from IPython.display import display
from PIL import Image
uncond="ConditionalAnalysis/MG.Itals.noDups.UNRELATED.hg38.glm.Rsq03.maf001cases.unconditioned.chr8.manhattan_v1.jpeg"
display(Image.open(uncond))
cond="ConditionalAnalysis/MG.Itals.noDups.UNRELATED.hg38.glm.condition.chr8_108247378_T_C.chr8.maf001cases.manhattan_v1.jpeg"
display(Image.open(cond))
from IPython.display import display
from PIL import Image
uncond="ConditionalAnalysis/MG.Itals.noDups.UNRELATED.hg38.glm.Rsq03.maf001cases.unconditioned.chr10.manhattan_v1.jpeg"
display(Image.open(uncond))
cond="ConditionalAnalysis/MG.Itals.noDups.UNRELATED.hg38.glm.condition.chr10_7410781_A_G.chr10.maf001cases.manhattan_v1.jpeg"
display(Image.open(cond))
from IPython.display import display
from PIL import Image
uncond="ConditionalAnalysis/MG.Itals.noDups.UNRELATED.hg38.glm.Rsq03.maf001cases.unconditioned.chr11.manhattan_v1.jpeg"
display(Image.open(uncond))
cond="ConditionalAnalysis/MG.Itals.noDups.UNRELATED.hg38.glm.condition.chr11_95578258_T_C.chr11.maf001cases.manhattan_v1.jpeg"
display(Image.open(cond))
from IPython.display import display
from PIL import Image
uncond="ConditionalAnalysis/MG.Itals.noDups.UNRELATED.hg38.glm.Rsq03.maf001cases.unconditioned.chr18.manhattan_v1.jpeg"
display(Image.open(uncond))
cond="ConditionalAnalysis/MG.Itals.noDups.UNRELATED.hg38.glm.condition.chr18_62355088_C_T.chr18.maf001cases.manhattan_v1.jpeg"
display(Image.open(cond))
Notes:
Index variants:
%%bash
cd ConditionalAnalysis
head -n 1 ./toArchive/MG.Itals.noDups.UNRELATED.hg38.conditioned.glm_chr1.PHENO.glm.logistic.hybrid > MG.Itals.noDups.UNRELATED.hg38.glm.condition.tophits.txt
tail -n +2 ./toArchive/MG.Itals.noDups.UNRELATED.hg38.conditioned.glm_chr1.PHENO.glm.logistic.hybrid >> MG.Itals.noDups.UNRELATED.hg38.glm.condition.tophits.txt
tail -n +2 ./toArchive/MG.Itals.noDups.UNRELATED.hg38.conditioned.glm_chr2.PHENO.glm.logistic.hybrid >> MG.Itals.noDups.UNRELATED.hg38.glm.condition.tophits.txt
tail -n +2 ./toArchive/MG.Itals.noDups.UNRELATED.hg38.conditioned.glm_chr6.PHENO.glm.logistic.hybrid >> MG.Itals.noDups.UNRELATED.hg38.glm.condition.tophits.txt
tail -n +2 ./toArchive/MG.Itals.noDups.UNRELATED.hg38.conditioned.glm_chr8.PHENO.glm.logistic.hybrid >> MG.Itals.noDups.UNRELATED.hg38.glm.condition.tophits.txt
tail -n +2 ./toArchive/MG.Itals.noDups.UNRELATED.hg38.conditioned.glm_chr10.PHENO.glm.logistic.hybrid >> MG.Itals.noDups.UNRELATED.hg38.glm.condition.tophits.txt
tail -n +2 ./toArchive/MG.Itals.noDups.UNRELATED.hg38.conditioned.glm_chr11.PHENO.glm.logistic.hybrid >> MG.Itals.noDups.UNRELATED.hg38.glm.condition.tophits.txt
tail -n +2 ./toArchive/MG.Itals.noDups.UNRELATED.hg38.conditioned.glm_chr18.PHENO.glm.logistic.hybrid >> MG.Itals.noDups.UNRELATED.hg38.glm.condition.tophits.txt
%%bash
cd ConditionalAnalysis
module load R/3.5.2
R --vanilla --no-save
# Load libraries
require(data.table)
require(tidyverse)
# Read in data
summ <- fread("../MG.ITALS.noDups.UNRELATED.hg38.glm.Rsq03MAF00001_ALLchr.txt",header=T)
summ1 <- summ %>% filter(`#CHROM` != "1" &
`#CHROM` != "2" &
`#CHROM` != "6" &
`#CHROM` != "8" &
`#CHROM` != "10" &
`#CHROM` != "11" &
`#CHROM` != "18")
cond <- fread("MG.Itals.noDups.UNRELATED.hg38.glm.condition.tophits.txt",header=T)
both <- rbind(summ1,cond) %>% arrange(`#CHROM`,POS)
write.table(both,"MG.Itals.noDups.UNRELATED.hg38.MERGEDconditional.txt",quote=F,sep="\t",col.names=T,row.names=F)
%%bash
cd ConditionalAnalysis
#module load R/3.5.2
echo "Rscript ../../scripts/toMetaprep.glm.updated.v2.R MG.Itals.noDups.UNRELATED.hg38.MERGEDconditional.txt MG.Itals.noDups.UNRELATED.hg38.MERGEDconditional" > prep2.swarm
swarm --file prep2.swarm --logdir swarmOE_prep -g 120 --module R/3.5.2 --gres=lscratch:500 --time 4:00:00
%%bash
# for the additional independentt signal on chr 6
cd ConditionalAnalysis
module load R/3.5.2
for Variant in {chr6_31358836_A_G,chr6_31358836_A_G.chr6_32620936_T_C};
do
echo "Rscript ../../scripts/toMetaprep.glm.updated.v2.R MG.Itals.noDups.UNRELATED.hg38.glm.condition.${Variant}.chr6.maf001cases.txt MG.Itals.noDups.UNRELATED.hg38.glm.condition.${Variant}.chr6.maf001cases" >> prep3.swarm
done
swarm --file prep3.swarm --logdir swarmOE_prep -g 120 --module R/3.5.2 --gres=lscratch:500 --time 4:00:00